"""@Project -> File   ：python -> 2021-12-10-python面向对象编程
   @IDE    ：PyCharm
   @Author ：PengLinxi
   @Date   ：2021/12/10 16:14
"""


# 使用类实现迭代器，实现斐波拉契数列


class Fib():

    def func1(self,num):

        self.num1, self.num2 = 1, 1
        self.lst = [1,1]
        self.count = 2
        self.count1 = 0
        self.num = num

        while self.count< self.num:
            result = self.num1 +self.num2
            self.lst.append(result)
            self.num1,self.num2 = self.num2,self.num1+self.num2
            self.count += 1

        self.lst1 = self.lst.__iter__()

        while self.count1<len(self.lst):
            print(self.lst1.__next__())
            self.count1 += 1

value = int(input("输出几个斐波拉契数列值："))
f = Fib()
f.func1(value)


